package com.medicine.hbp.kankan.cardslide;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.medicine.hbp.R;
import com.medicine.hbp.mob.findVoteArtRandomVo;
import com.medicine.hbp.ui.WebActivity;
import com.nostra13.universalimageloader.core.ImageLoader;

/**
 */
@SuppressLint("NewApi")
public class CardItemView extends LinearLayout {

    public ImageView imageView;
    private TextView userNameTv;
    private TextView imageNumTv;
    private TextView likeNumTv;
    private TextView card_context;

    public CardItemView(Context context) {
        this(context, null);
    }

    public CardItemView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public CardItemView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        inflate(context, R.layout.card_item, this);
        imageView = (ImageView) findViewById(R.id.card_image_view);
        userNameTv = (TextView) findViewById(R.id.card_user_name);
        imageNumTv = (TextView) findViewById(R.id.card_pic_num);
        likeNumTv = (TextView) findViewById(R.id.card_like);
        card_context = (TextView) findViewById(R.id.card_context);
    }

    public void fillData(final findVoteArtRandomVo itemData) {
    	imageView.setImageResource(R.color.white);
        ImageLoader.getInstance().displayImage(itemData.artImgUrl, imageView);
        userNameTv.setText(itemData.art_title);
        imageNumTv.setText(itemData.artNegativeNumber + "");
        likeNumTv.setText(itemData.artPraiseNumber + "");
        card_context.setText(itemData.artMsg);
        imageView.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(getContext(),WebActivity.class);
				intent.putExtra("ID", itemData.artId);
//				intent.putExtra("vo", Vo);
				intent.putExtra("NAME", "������������");
				getContext().startActivity(intent);
				
			}
		});
    }
}
